function [Node,Element,Material,Load,Constr] = MFEABernoulli3Ddata(filename)
addpath("input\")
fid = fopen(strcat(filename,'.txt'), 'r');
Node = [];
Element = [];
Material = [];
Load =[];
Constr = [];
DF = [];

isNodeSection = false;
isElementSection = false;
isMaterialSection = false;
isLoadSection = false;
isDFSection = false;
isConstrSection = false;

while ~feof(fid);
    line = fgetl(fid);
    

    if isempty(line)
        continue;
    end
    
    if strncmp(line, '*Node', 5)
        isNodeSection = true;
        isElementSection = false;
        isLoadSection = false;
        isConstrSection = false;
        isDFSection = false;
        isMaterialSection = false;
        continue;  
    elseif strncmp(line, '*Element', 8)
        isNodeSection = false;
        isElementSection = true;
        isLoadSection = false;
        isConstrSection = false;
        isDFSection = false;
        isMaterialSection = false;
        continue;  
    elseif strncmp(line, '*Material', 9)
        isNodeSection = false;
        isElementSection = false;
        isLoadSection = false;
        isConstrSection = false;
        isDFSection = false;
        isMaterialSection = true;
        continue; 
    elseif strncmp(line, '*Load', 5)
        isNodeSection = false;
        isElementSection = false;
        isLoadSection = true;
        isConstrSection = false;
        isDFSection = false;
        isMaterialSection = false;
        continue;  
    elseif strncmp(line, '*DF', 3)
        isNodeSection = false;
        isElementSection = false;
        isLoadSection = false;
        isDFSection = true;
        isConstrSection = false;
        isMaterialSection = false;
        continue; 
    elseif strncmp(line, '*Constr', 7)
        isNodeSection = false;
        isElementSection = false;
        isLoadSection = false;
        isConstrSection = true;
        isDFSection = false;
        isMaterialSection = false;
        continue;  
    end
    
    if isNodeSection
        
        data = sscanf(line, '%d, %f, %f, %f');
        if numel(data) >= 3
            Node = [Node; data(2), data(3),data(4)];
        end
    elseif isElementSection
        
        data = sscanf(line, '%d, %d, %d');
        if numel(data) >= 3
            Element = [Element; data(2), data(3)];
        end
    
    elseif isMaterialSection
       
        data = sscanf(line, '%f, %f,%f,%f, %f,%f');
        if numel(data) >= 2
            Material = [Material; data(1), data(2),data(3), data(4), data(5),data(6)];
        end
        
    elseif isLoadSection
        
        data = sscanf(line, '%d, %d, %f');
        if numel(data) >= 3
            Load = [Load; data(1), data(2), data(3)];
        end

    elseif isDFSection
        
        data = sscanf(line, '%f, %f, %f, %d');
        if numel(data) >= 4
            DF = [DF; data(1), data(2), data(3), data(4)];
        end
        
    elseif isConstrSection
       
        data = sscanf(line, '%d, %d, %f');
        if numel(data) >= 3
            Constr = [Constr; data(1), data(2), data(3)];
        end
    end
end


fclose(fid);
end
